package com.njbw.user.db;

import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

@Log4j2
@Service
public class BackUpServiceImpl implements BackUpService {

    @Resource
    private BackUpDataFactory backUpDataFactory;

    @Override
    public void backUp(BackUpDataSceneEnum sceneEnum) {
        log.info("BackUpServiceImpl.backUp.scene: {}", sceneEnum.getCode());
        BackUpDataHandler backUpDataHandler = backUpDataFactory.getHandlerByCode(sceneEnum.getCode());
        if (Objects.isNull(backUpDataHandler)) {
            log.info("BackUpServiceImpl.noFindScene!");
            return;
        }
        backUpDataHandler.backUpData();
    }
}
